package cn.topevery.garden.dal.logic.warning;

import cn.topevery.garden.dal.logic.base.WarningBase;
import cn.topevery.garden.entity.dto.UploadFileDTO;
import cn.topevery.garden.entity.po.VideoSafeRecord;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @author ：peng.tian
 * @date ：Created in 2021/10/27 14:44
 * @description：安全监控报警
 */
@Component
public class IotDeviceVideoSafeWarning extends WarningBase {
    @Override
    public String getClassId() {
        return "B486F629-663C-48B4-B1CC-2131B3EE49AE";
    }

    @Override
    public String getFacilitiesType() {
        return "1cacd297-4f16-49fd-85e1-07d1d1959ce0";
    }

    @Override
    public String getWarningType() {
        return "95B43414-47DB-4987-AC10-53C06485EF7E";
    }

    /**
     * 生成报警信息
     * @param data
     */
    public void createWarning(VideoSafeRecord data, UploadFileDTO fileDTO) throws Exception {
        //添加案件附件
        StringBuilder warningDesc = new StringBuilder();
        warningDesc.append(data.type);
        if(fileDTO!=null){
           this.uploadFileDTOS= Arrays.asList(fileDTO);
        }

        this.sendWarning(data.getDeviceCode(), warningDesc.toString(), data.getId());
    }
}
